package com.bolang.onlycode.demo.ThreadPool;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ScheduleThreadPoolExecutorTest {
    public static void main(String[] args) {
        System.out.println("当前系统时间"+System.currentTimeMillis());
        //使用该构造方法默认最大核心线程数为Interger_Max
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5);
        executor.schedule(new Runnable() {
            @Override
            public void run() {
                System.out.println("开始执行时间"+System.currentTimeMillis());
            }
        },2, TimeUnit.SECONDS);
        //延迟两秒再执行
        executor.shutdown();
    }

}
